<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<!-- jQplot CSS -->

<link rel="stylesheet" media="screen" href="css/Tree.css" />
<link rel="stylesheet" media="screen" href="css/docs.css" />
<!-- jQplot CSS END -->

<!-- DATATABLES CSS -->
<link rel="stylesheet" media="screen" href="lib/datatables/css/vpad.css" />
<!-- DATATABLES CSS END -->
<script type="text/javascript" src="${ctx}/js/global_util.js"></script>

<h1 class="page-title">${listTitle}</h1>
<div class="container_12 clearfix leading">
	<section class="tabs grid_12 leading">
		<ul class="clearfix">
			<li><a href="javascript:void(0)" class="current">上传</a></li>
		</ul>
		<section>
			<section class="clearfix" style="display: block;">
				<header class="grid_12 alpha omega"> </header>
				<div id="demo" class="clearfix">
					<table class="display" id="example">
						<thead>
							<tr>
								<th>培训课程</th>
								<th>开始日期</th>
								<th>结束日期</th>
								<th>培训对象</th>
								<th>培训类型</th>
								<th>地点</th>
								<th>讲师</th>
								<th>讲师类别</th>
							</tr>
						</thead>
						<tbody>
							<tr class="gradeX">
								<td>${plan.title}</td>
								<td><fmt:formatDate value="${plan.trainStartDate}"
										pattern="yyyy-MM-dd HH:mm" /></td>
								<td><fmt:formatDate value="${plan.trainEndDate}"
										pattern="yyyy-MM-dd HH:mm" /></td>
								<td><span name="td_dutytarget" title="${plan.id}"></span></td>
								<td>${plan.category}</td>
								<td>${plan.classroom}</td>
								<td><s:if test="#plan.lecturerType==0">${plan.trainLecturer.employeeinfoWork.baseId.name}</s:if>
									<s:else>${plan.outingLecturer}</s:else></td>
								<td><s:if test="#plan.lecturerType==0">内聘</s:if> <s:else>外训</s:else></td>
							</tr>
						</tbody>
					</table>
				</div>
				<div class="clear" style="height: 20px"></div>
				<div id="list_content_resource" class="clearfix"></div>
			</section>
		</section>
	</section>
</div>
<div class="clear"></div>

<script type="text/javascript">
	$(function() {
		setTimeout('loadListContent("${ctx}${listAction}", ${plan.id})', 600);
		$("span[name='td_dutytarget']").each(function(i) {
			loadDutyTarget(this, $(this).attr("title"));
		});
	})
	
	function loadDutyTarget(obj, planId) {
		$.ajax({
			type : "get",
			url : "/ajax/query_dutytarget.xhtml?planId=" + planId,
			//data: "name=John&location=Boston",
			dataType : "html",
			success : function(data) {
				if (data != null) {
					$(obj).html(data);
				}
			}
		});
	}

	function loadListContent(url, planId) {
		var data = {
			"planId":planId,
			"organizationId":${organizationId}
		};
		//refreshListContent(url, data);
		$.ajax(url, {
			type : "POST",
			data : data,
			dataType : "html",
			cache : false,
			success : function(a) {
				var obj = $("#list_content_resource");
				obj.html("");
				obj.append(a);
			},
			complete : function() {
			}
		});
	}

</script>